package org.fatmansoft.teach.entity.ViewEntity;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.fatmansoft.teach.entity.ViewEntity.Teacher;
import org.springframework.format.annotation.DateTimeFormat;

import javax.persistence.*;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.Size;

@Data
@NoArgsConstructor
@AllArgsConstructor
@Entity
@Table(	name = "course",
        uniqueConstraints = {
                @UniqueConstraint(columnNames = {"id"}),
        })  //此项columnNames列出的是该表中要建立唯一性约束的列名
public class Course {
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private Integer id;

    @Size(max = 50)
    private String courseName;

    @Size(max = 50)
    private String book;  //教材信息


    @Size(max = 200)
    private String courseInfo;  //课程信息

    @ManyToOne
    @JoinColumn(name = "teacher_id")
    private Teacher teacher;

    private Integer credit;
}
